/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/rng/fortuna/fnaPRNG.h,v 1.3 2003/11/21 12:39:24 itsme Exp $
 *
 *
 */


#ifndef __FNAPRNG_H__
//--------------------------------------------------------------------------

#include "vectorutils.h"
#include "nhThread.h"
#include "fnaAccumulator.h"
#include "fnaEntropySource.h"

typedef std::vector<HANDLE> EventList;
typedef std::vector<EntropySource*> SourceList;

#define PRNG_POLL_INTERVAL 2000

class PRNG : public NHThread {
public:
    PRNG();
    ~PRNG();

    bool RandomData(int nBytesRequested, ByteVector& r);

    void AddSource(EntropySource* src);

protected:
    virtual DWORD ThreadProc();
    virtual const char* name() const { return "PRNG"; }

private:
    Accumulator m_accu;

    // list of registered entropy sources
    SourceList m_sources;

    // event list is needed by WaitForMultipleEvents
    EventList m_sourceevents;
};


#define __FNAPRNG_H__
#endif
